package com.renjiyue;

import com.renjiyue.pojo.Address;
import com.renjiyue.pojo.Student;
import com.renjiyue.pojo.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class test1 {
    @Test
    public void test2(){
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        Student student = (Student)context.getBean("student");
        student.show();
    }
    @Test
    public void test3(){
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        User user = (User) context.getBean("user01");
        System.out.println(user);

        Address address01 = (Address) context.getBean("address1");
        System.out.println(address01.getAddress());
    }
}
